
#include<stdio.h>
#include<unistd.h>
#include <unistd.h>
#include <sys/eventfd.h>
#include <fcntl.h>
int main()
{
    int fd=eventfd(0,EFD_CLOEXEC|EFD_NONBLOCK);
    if(fd<0)
    {
        perror("eventfd failed");
        return -1;
    }
    uint64_t cnt=1;
   write(fd,&cnt,sizeof(uint64_t));
   write(fd,&cnt,sizeof(uint64_t));
   write(fd,&cnt,sizeof(uint64_t));
   uint64_t num=0;
   read(fd,&num,sizeof(uint64_t));
    printf("read num:%lu\n",num);
    close(fd);  
    return 0;
}